package online.longzipeng.householdbillssystem.common.exception;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import online.longzipeng.householdbillssystem.common.result.ResponseEnum;

/**
 * @Author: lzp
 * @Date: 2021/2/7 18:58
 * 系统的业务异常
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppException extends RuntimeException {
    private String code;
    private String message;
    private Object data;

    public AppException(ResponseEnum responseEnum){
        this.code = responseEnum.getCode();
        this.message = responseEnum.getMessage();
    }

    public AppException(ResponseEnum responseEnum,Object data){
        this.code = responseEnum.getCode();
        this.message = responseEnum.getMessage();
        this.data = data;
    }

}
